/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package game;

import java.io.Serializable;
import java.util.Comparator;
import other.Costants;

/**
 *
 * @author alessandro
 */
public class Card implements Serializable, Comparator{
    private String state;
    private String seed;
    private int number;

    public Card(String seed, int number) {
        this.seed = seed;
        this.number = number;
        state = Costants.IN_DECK;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public String getSeed() {
        return seed;
    }

    public void setSeed(String seed) {
        this.seed = seed;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    @Override
    public int compare(Object o1, Object o2) {
        String seed1 = ((Card) o1).getSeed();
        String seed2 = ((Card) o2).getSeed();
        int number1 = ((Card) o1).getNumber();
        int number2 = ((Card) o2).getNumber();

        if (seed1.compareTo(seed2) < 0) {
            return -1;
        } else if (seed1.compareTo(seed2) > 0) {
            return 1;
        } else if (seed1.compareTo(seed2) == 0) {
            if (number1 > number2) {
                return 1;
            } else if (number1 < number2) {
                return -1;
            } else if (number1 == number2) {
                return 0;
            }
        }
        return 0;
    }
    
}